<template>
  <div class="doneList-container center">
    <h2>
      全部
      <Count>
        {{ total }}
      </Count>
    </h2>
    <ul>
      <!-- todo-list -->
      <template v-for="item in todoList">
        <component :is="item.comName" :key="item.id" :item="item" v-if="item.finished === false"></component>
      </template>
      <!-- done-list -->
      <template v-for="item in doneList">
        <component class="list-item" :is="item.comName" :key="item.id" :item="item"></component>
      </template>
    </ul>
  </div>
</template>

<script>
import Count from '@/components/Count/Count.vue'
import ListItem from '@/components/ListItem/ListItem.vue'
import { mapGetters, mapState } from 'vuex'
export default {
  components: { Count, ListItem },
  computed: {
    ...mapGetters(['total']),
    ...mapState(['todoList', 'doneList'])
  }
}
</script>

<style lang="less" scoped>
h2 {
  position: relative;
}
.list-item {
  border-left: 5px solid #999 !important;
  background-color: #e6e6e6 !important;
  opacity: 0.5;
}
</style>
